class Token
  attr_reader :token, :klass, :position

  def initialize(token,klass,position=nil)
    @token     = token
    @klass     = klass
    @position  = position
  end

  def line
    @position.line if @position
  end

  def nchar
    @position.position if @position
  end

  def to_s
    return "<#{@klass},#{@token}> #{@position.to_s}" if @position
    return "<#{@klass},#{@token}>"
  end
end

